﻿<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>职位发布变更管理</title>
    <script src="https://cdn.jsdelivr.net/npm/vue@3.3.4/dist/vue.global.min.js"></script>
    <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
    <link rel="stylesheet" href="https://unpkg.com/element-plus/dist/index.css">
    <script src="https://unpkg.com/element-plus/dist/index.full.min.js"></script>
    <script src="https://unpkg.com/element-plus/dist/locale/zh-cn.min.js"></script>
    <style>
        .position-change {
            padding: 20px;
            background-color: #fff;
        }

        .breadcrumb {
            margin-bottom: 15px;
            font-size: 14px;
            color: #666;
        }

        .statistics {
            margin-bottom: 20px;
            font-size: 14px;
        }

        .position-table {
            margin-bottom: 20px;
        }

        .pagination {
            display: flex;
            align-items: center;
            justify-content: flex-start;
            gap: 15px;
            font-size: 14px;
        }
    </style>
</head>
<body>
    <div id="app">
        <div class="position-change">
            <div class="breadcrumb">
                <span>您正在做的业务是：</span>
                <span>人力资源 > 招聘管理 > 面试管理 > 有效简历列表</span>
            </div>

            <div class="statistics">
                当前可变更是职位发布总数：{{ rows }} 例
            </div>

            <el-table :data="tableData" style="width: 100%">
                <el-table-column prop="res_id" label="档案编号"></el-table-column>
                <el-table-column prop="human_name" label="姓名"></el-table-column>
                <el-table-column prop="human_sex" label="性别"></el-table-column>
                <el-table-column prop="human_major_kind_name" label="职位分类"></el-table-column>
                <el-table-column prop="human_major_name" label="职位名称"></el-table-column>
                <el-table-column prop="human_telephone" label="电话号码"></el-table-column>
                <el-table-column prop="interview_status"
                                 label="面试状态"
                                 :formatter="formatInterviewStatus"></el-table-column>

                <el-table-column label="登记">
                    <template #default="scope">
                        <el-button type="link" v-on:click="Update(scope.row)">登记</el-button>
                    </template>
                </el-table-column>
            </el-table>

            <el-pagination v-model:current-page="currentPage"
                           v-model:page-size="pageSize"
                           :page-sizes="[2, 4, 6, 8, 10]"
                           layout="total, sizes, prev, pager, next, jumper"
                           :total="rows"
                           v-on:size-change="handleSizeChange"
                           v-on:current-change="handleCurrentChange"></el-pagination>
        </div>
    </div>

    <script type="text/javascript">
        const { createApp, ref, reactive, computed, onMounted } = Vue;
        const { ElMessage } = ElementPlus;

        const app = createApp({
            setup() {
                const dialogVisible = ref(false);
                const tableData = ref([]);
                const currentPage = ref(1);
                const pageSize = ref(2);
                const rows = ref(0);

                const rowData = reactive({
                  imageUrl:'',
                  res_id: null,
                  human_major_kind_id: '01',
                  human_major_kind_name: '销售',
                  human_major_id: '02',
                  human_major_name: '总经理',
                  engage_type: '社会招聘',
                  human_name: '',
                  human_sex: '',
                  human_email: '',
                  human_picture: '',
                  human_telephone: '',
                  human_homephone: '',
                  human_mobilephone: '',
                  human_address: '',
                  human_postcode: '',
                  human_nationality: '',
                  human_birthplace: '',
                  human_birthday: '2005-02-05',
                  human_race: '',
                  human_religion: '无',
                  human_party: '',
                  human_idcard: '',
                  human_age: '',
                  human_college: '',
                  human_educated_degree: '',
                  human_educated_years: '',
                  human_educated_major: '',
                  demand_salary_standard: '',
                  human_specility: '',
                  human_hobby: '',
                  human_history_records: '',
                  remark: '',
                  recomandation: '',
                  attachment_name: '',
                  check_status: null,
                  register: '系统自动',
                  regist_time: '',
                  checker: '',
                  check_time: '',
                  interview_status: null,
                  total_points: null,
                  test_amount: null,
                  test_checker: '',
                  test_check_time: '',
                  pass_register: '',
                  pass_regist_time: '',
                  pass_checker: '',
                  pass_check_time: '',
                  pass_check_status: null,
                  pass_checkComment: '',
                  pass_passComment: ''
                });

                const formatInterviewStatus = (row) => {
                  const statusMap = {
                    '0': '待面试',
                    '1': '面试通过'
                  }
                  return statusMap[row.interview_status] || row.interview_status;
                }

                const Update = (rowData) => {
                    console.log("修改数据:", rowData);
                    const encodedData = encodeURIComponent(JSON.stringify(rowData));
                    const baseUrl = '@Url.Action("resumeregister", "engage")';
                    const urlWithParams = `${baseUrl}?data=${encodedData}`;
                    window.location.href = urlWithParams;
                };

                function fill() {
                    axios.get('/engage/Updatefy', {
                        params: {
                            currentPage: currentPage.value,
                            pageSize: pageSize.value
                        }
                    }).then(res => {
                        tableData.value = res.data.list;
                        rows.value = res.data.rows;
                    }).catch(err => {
                        console.error(err);
                    });
                }

                function handleSizeChange(size) {
                    pageSize.value = size;
                    fill();
                }

                function handleCurrentChange(cpage) {
                    currentPage.value = cpage;
                    fill();
                }

                onMounted(() => {
                    fill();
                });

                return {
                    dialogVisible,
                    tableData,
                    currentPage,
                    pageSize,
                    rows,
                    rowData,
                    Update,
                    formatInterviewStatus,
                    handleCurrentChange,
                    handleSizeChange
                };
            }
        });

        app.use(ElementPlus, {
            locale: ElementPlusLocaleZhCn
        });

        app.mount('#app');
    </script>
</body>
</html>